home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / pccursor.zip / PCCURSOR.CPP < prev    next >
C/C++ Source or Header  |  1991-04-15  |  1KB  |  71 lines

  1. /*
  2.  
  3.     pccursor.cpp
  4.     4-15-91
  5.     Cursor shape class for IBM PC text modes.
  6.  
  7.     Copyright 1991
  8.     John W. Small
  9.     All rights reserved
  10.     Use freely but acknowledge authorship and copyright.
  11.     CIS: 73757,2233
  12.  
  13.     PSW / Power SoftWare
  14.     P.O. Box 10072
  15.     McLean, Virginia 22102 8072
  16.     USA (703) 759-3838
  17.  
  18. */
  19.  
  20. #include <pccursor.hpp>
  21.  
  22. void CursorShape::putshape(unsigned shape)
  23. { /* Don't make inline to avoid optimizer induced errors! */
  24.     prevshape = getshape();
  25.     _CX = shape;
  26.     _AH = 0x01;
  27.     geninterrupt(0x10);
  28. }
  29.  
  30. /*
  31.     Comment out "#define TEST_PCCURSOR_CPP" below to use
  32.     pccursor.cpp in your application.
  33. */
  34.  
  35. #define TEST_PCCURSOR_CPP
  36. #ifdef TEST_PCCURSOR_CPP
  37.  
  38. #include <conio.h>
  39.  
  40. CursorShape C;
  41.  
  42. main()
  43. {
  44.     cputs("Press any key to continue at pauses.\r\n");
  45.     cputs("\r\nStarting cursor shape: ");
  46.     getch();
  47.     cputs("\r\nBlock cursor: ");
  48.     C.block();
  49.     getch();
  50.     cputs("\r\nNormal cursor: ");
  51.     C.normal();
  52.     getch();
  53.     cputs("\r\nInvisible cursor: ");
  54.     C.off();
  55.     getch();
  56.     cputs("\r\nVisible cursor: ");
  57.     C.on();
  58.     getch();
  59.     cputs("\r\nBlock cursor again to demo restore: ");
  60.     C.block();
  61.     getch();
  62.     cputs("\r\nRestore cursor: ");
  63.     C.restore();
  64.     getch();
  65.     cputs("\r\nBlock cursor again to demo destructor: ");
  66.     C.block();
  67.     getch();
  68.     return 0;
  69. }
  70.  
  71. #endif